import './index.less';

$('.right-fixed-nav2').show();
$(window).on('scroll', () => {
  const st = $(window).scrollTop();
  const wh = $(window).height();

  if (st > wh) {
    $('.right-fixed-nav2 .top').addClass('radius').show();
    $('.right-fixed-nav2 .weixin').removeClass('radius');
  } else {
    $('.right-fixed-nav2 .top').hide();
    $('.right-fixed-nav2 .weixin').addClass('radius');
  }
});

$('.right-fixed-nav2 .top').on('click', () => {
  $('html, body').animate({
    scrollTop: 0
  }, 500);
  return false;
});

$('.right-fixed-nav2 .kefu').on('click', () => {
  open_kefu();
});
function open_kefu() {
  const url = 'https://p.qiao.baidu.com/cps/chat?siteId=17703851&userId=33651932&siteToken=25b3e7ac69f5b12c1fc2e0367d02eb0d';//客服
  const name = "";//网页名称，可为空;
  const iWidth = 800;//弹出窗口的宽度;
  const iHeight = 700;//弹出窗口的高度;
  //window.screen.height获得屏幕的高，window.screen.width获得屏幕的宽
  const iTop = (+window.screen.height - 30 - +iHeight) / 2;//获得窗口的垂直位置;
  const iLeft = (+window.screen.width - 10 - +iWidth) / 2;//获得窗口的水平位置;
  window.open(url, name, 'height=' + iHeight + ',innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
}
